Skip to content

fix: validate cloud config before deployment creation - #638

Merged
alongubkin merged 3 commits into
mainfrom
alon/alien-853-preflight-cloud-config
Sep 18, 2026
Merged

alongubkin merged 3 commits into
mainfrom
alon/alien-853-preflight-cloud-config

Conversation

@alongubkin

Copy link
Copy Markdown
Member

Background

alien deploy created or registered the deployment first, persisted its deployment-scoped token in the runner-local tracker, and only then loaded the target cloud configuration. A basic local prerequisite error such as a missing AWS region therefore left a durable pending deployment even though no cloud operation could begin. This is especially painful in ephemeral CI because the runner that holds the tracker may disappear.

Reproduce

  1. Use a fresh runner with valid Platform/project authentication but no usable AWS region configuration.
  2. Run alien deploy --platform aws ... for a new deployment.
  3. Before this change, the Platform deployment record and token are created first; ClientConfig::from_std_env(Platform::Aws) then fails while provisioning begins.
  4. A retry from another runner must discover/recover or delete the orphaned pending record.

Fix

Build and validate the provider client immediately after resolving the requested platform, before tracker lookup, deployment-group session creation, deployment creation, or token persistence. The validated client is retained and reused by the provisioning loop.

Machines remains exempt because it creates a join command and does not use a runner-local cloud client. Local development still exits into its dedicated path before this validation.

This is local feasibility validation only; authoritative account/project/subscription checks and cloud ownership protections remain unchanged.

Validation

  • cargo check -p alien-cli
  • focused deploy tests: 7 passed, 275 skipped
  • rustfmt and git diff --check

Linear: ALIEN-853

@greptile-apps

greptile-apps Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

The PR appears safe to merge; the latest changes preserve existing environment-loading behavior while validating provider prerequisites before durable deployment creation.

Summary

The PR moves cloud-provider client configuration validation ahead of deployment lookup, creation, and token persistence, while preserving the special handling for Local and Machines deployments.

  • Reuses the prevalidated client configuration during provisioning.
  • Introduces an injectable environment map to make provider validation deterministic in tests.
  • Adds a regression test proving invalid Azure configuration fails without contacting the deployment API.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Resolve deploy arguments] --> B{Target platform}
    B -->|Local| C[Use dedicated local path]
    B -->|Machines| D[Skip cloud client validation]
    B -->|Cloud provider| E[Build and validate client configuration]
    E -->|Invalid| F[Return configuration error]
    E -->|Valid| G[Lookup or create deployment]
    D --> G
    G --> H{Machines deployment?}
    H -->|Yes| I[Return host join command]
    H -->|No| J[Reuse validated client configuration]
    J --> K[Run provisioning loop]
Loading

Reviews (3) · Last reviewed commit: "test: prove preflight makes no deploymen..."

@alongubkin

Copy link
Copy Markdown
Member Author

@greptileai Please re-review the latest head, including the independent-review follow-up fixes and regressions.

@alongubkin

Copy link
Copy Markdown
Member Author

@greptileai please re-review the latest head, including the addressed independent-review regression.

…ght-cloud-config

# Conflicts:
#	crates/alien-cli/src/commands/deploy.rs
@alongubkin
alongubkin merged commit 37b4b46 into main Sep 18, 2026
20 checks passed
@alongubkin
alongubkin deleted the alon/alien-853-preflight-cloud-config branch September 18, 2026 00:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant